from watchtower.setting_files.const import BASE_DIR

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.template.context_processors.static',
                'django.template.context_processors.media',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'motherbox.context_processor.site',
            ],
        },
    },
]

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / "data" / "static"
if not STATIC_ROOT.exists() or not STATIC_ROOT.is_dir():
    STATIC_ROOT.mkdir(parents=True)

STATICFILES_DIRS = [BASE_DIR / "static", ]
for staticfiles_dir in STATICFILES_DIRS:
    if not staticfiles_dir.exists() or not staticfiles_dir.is_dir():
        staticfiles_dir.mkdir(parents=True)

# Media files (File, ImageField) will be save these
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'data' / 'media'
if not MEDIA_ROOT.exists() or not MEDIA_ROOT.is_dir():
    MEDIA_ROOT.mkdir(parents=True)

# Max post update field num
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000
